#ifndef COMPOSITE_H_
#define COMPOSITE_H_

#include <list>
#include <string>

class Equipment
{
protected:
	Equipment(const char* pName, const double price);

public:
	virtual ~Equipment();

public:
	virtual void show(std::string format = "");
	virtual double price();

	virtual bool add(Equipment* pEquip);
	virtual bool remove(Equipment* pEquip);

	// could define "parent"

protected:
	std::string m_sName;
	double m_dPrice;
	std::list<Equipment *> m_equipList;
};

class CompositeEquipment : public Equipment
{
protected:
	CompositeEquipment(const char* pName, const double price)
		: Equipment(pName, price) {}

public:
	virtual void show(std::string format = "");
	virtual double price();

	virtual bool add(Equipment* pEquip);
	virtual bool remove(Equipment* pEquip);
};

class Computer : public CompositeEquipment
{
public:
	Computer(const char* pName, const double price)
		: CompositeEquipment(pName, price) {}
};

class Monitor : public Equipment
{
public:
	Monitor(const char* pName, const double price)
		: Equipment(pName, price) {}
};

class Chassis : public CompositeEquipment
{
public:
	Chassis(const char* pName, const double price)
		: CompositeEquipment(pName, price) {}
};

class MotherBoard : public CompositeEquipment
{
public:
	MotherBoard(const char* pName, const double price)
		: CompositeEquipment(pName, price) {}
};

class CPU : public Equipment
{
public:
	CPU(const char* pName, const double price)
		: Equipment(pName, price) {}
};

class AudioCard : public Equipment
{
public:
	AudioCard(const char* pName, const double price)
		: Equipment(pName, price) {}
};

#endif // COMPOSITE_H_
